<!DOCTYPE html>
<html>
<body onload="runTest()">
<p>This tests moving a node list that uses atomic string gets adopted to a new document properly.<br>
The test passes if WebKit does not hit an assertion.</p>
<script>

if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

function runTest()
{
    var newDocument = document.implementation.createDocument(null, "someElement", null);
    var fragment = document.createDocumentFragment();
    newDocument.documentElement.getElementsByTagName("foo");
    fragment.appendChild(newDocument.documentElement);

    setTimeout(function () {
        document.querySelector('p').innerHTML += '<br><br>PASS';
        if (window.testRunner)
            testRunner.notifyDone();
    }, 0);
}

</script>
</body>
</html>
